import axios from 'axios'
const request = axios.create({
    baseURL: 'http://gw.zjyd.testa/',
    withCredentials: true,
    timeout: 50000
})
request.interceptors.request.use((config) => {
  
    config.headers.token = 'xxxxx' 
    return config;
}, (error) => {
    return Promise.reject(error);
});
request.interceptors.response.use((response) => {
    return response
}, (error) => {
    return Promise.reject(error)
})
export const post = (url, params = {}) => {
    return new Promise((resolve) => {
        request.post(url, params)
        .then((res) => {
          resolve(res);
        })
        .catch((err) => {
          if (err.code != 0) {
           console.log(err)
          }
        });
    });
  };
export default request